package movee.spring.app.template.domain.repository;

import movee.spring.app.template.domain.dao.OrderDao;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 *
 *
 * @author movee
 */
@Repository
public interface OrderRepo extends BaseJpaRepository<OrderDao, Long> {

    @Query(value = "select o from OrderDao o", countQuery = "select count(o) from OrderDao o")
    @Override
    Page<OrderDao> findAllWithPage(Pageable pageable);

    @Query(value = "update OrderDao o set o.delete = 1 where o.id in (:ids)")
    @Override
    Integer softDeleteByIds(@Param(value = "ids") List<Long> ids);
}
